<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>按钮</title>
    <link rel="stylesheet" href="radio_.css">
</head>
<body>
<div class="content">
    <span>飞行模式</span>
    <div class="box">
        <div class="round"></div>
    </div>
</div>
</body>
<script>
    var int = document.getElementsByClassName("round")[0];
    var sum = document.getElementsByClassName("box")[0];
    sum.addEventListener("click",function () {
        if(parseInt(getComputedStyle(int).left)=== 0){
            int.style.left = "60"+ "px";
            int.style.transition = "all .2s ease-in";
            sum.style.backgroundColor="limegreen";
            sum.style.transition = "all .5s ease-in-out";
        }else{
            int.style.left = "0" + "px";
            int.style.transition = "all .2s ease-in";
            sum.style.backgroundColor="whitesmoke";
            sum.style.transition = "all .3s ease-in-out";
        }
    })
</script>
</html>